<%@ page contentType="text/html; charset=UTF-8" %>
<html>
<head>
<title>
testAJAX
</title>
</head>
<script type="text/javascript" language="javascript">
      //看你什麼時機喜歡去抓資料都可以，不需要重新Reload畫面.
      function getEmpName(id,namefield){
          //window.open('GetEmpName.jsp?DB_ALIAS=PIS1_BETA&DEBUG=true&SOURCE_CHARSET=big5&TARGET_CHARSET=big5&empno='+id);
          //alert(id);
          //var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
          //xmlDoc.async = "False";
          //xmlDoc.setProperty("ServerHTTPRequest", true);
          //xmlDoc.load('GetEmpName.jsp?DB_ALIAS=PIS1_BETA&DEBUG=true&SOURCE_CHARSET=big5&TARGET_CHARSET=big5&empno='+id);
          //xmlDoc.onreadystatechange = callback;
          //xmlDoc.send(null);
          //document.all.item('empname').value=xmlDoc.childNodes[1].text;
          //alert(xmlDoc.childNodes[1].text);

          var xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
          xmlDoc.Open("POST",'GetEmpName.jsp',false);
          xmlDoc.send();
          alert(xmlDoc.responseText);
          xmlDoc=null;
          //document.all.item(namefield).value = xmlDoc.selectSingleNode('dataset/row/Name').value;
          //oform.Depart.value = xmlDoc.selectSingleNode('dataset/row/Depart').value;
          //oform.RspArea.value = xmlDoc.selectSingleNode('dataset/row/RspArea').value;
      }

</script>
<body bgcolor="#ffffff">
<form method="post" action="testAJAX.jsp">
<input type="text" name="empno" size="10" maxlength="8" onchange="javascript:getEmpName(this.value,'empname');"/>
<input type="text" name="empname" size="10" maxlength="8"/>
</form>
</body>
</html>
